package Object类.equals方法.test03;

import java.util.Objects;

public class Student {
    int no;
    String school;

    public Student() {
    }

    public Student(int no, String school) {
        this.no = no;
        this.school = school;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return no == student.no &&
                Objects.equals(school, student.school);
    }



    public String toString() {
        return "学校{" +
                "学号=" + no +
                ", 学校名称='" + school + '\'' +
                '}';
    }


}
